<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Redis Seckill Demo</title>
</head>
<body>
<h1>HUAWEI MATE 40 5G!!!  1元秒杀！！！</h1>

<form id="msform" action="/seckill/doseckill">
	<input type="hidden" id="prodid" name="prodid" value="0101">
	<input type="button"  id="miaosha_btn" name="seckill_btn" value="秒杀点我"/>
</form>

</body>
<script  type="text/javascript" src="/seckill/script/jquery/jquery-3.1.0.js"></script>
<script  type="text/javascript">
$(function(){
	$("#miaosha_btn").click(function(){	  //给按钮增加单击事件处理
		var url=$("#msform").attr("action"); //获取表单的action属性值
	     $.post(url,$("#msform").serialize(),function(data){ //post方式发起ajax请求。
     		if(data=="false"){ //服务器端返回数据进行判断
    			alert("抢光了" );
    			$("#miaosha_btn").attr("disabled",true); //禁用按钮
    		}
		} );    
	})
})
</script>
</html>